#!/usr/bin/env python3
"""
全局配置设置
"""
import cv2

# 应用配置
APP_NAME = "图片识别与对比工具"
APP_VERSION = "1.0.0"
DEBUG = True

# 打印配置
ENABLE_PRINT = False  # 是否启用打印匹配结果，True表示打印，False表示不打印

# 结果图配置
ENABLE_RESULT_IMAGE = False  # 是否生成识别后的结果图，True表示生成，False表示不生成

# 匹配方法配置
MATCHING_METHODS = {
    "TM_CCOEFF": cv2.TM_CCOEFF,
    "TM_CCOEFF_NORMED": cv2.TM_CCOEFF_NORMED,
    "TM_CCORR": cv2.TM_CCORR,
    "TM_CCORR_NORMED": cv2.TM_CCORR_NORMED,
    "TM_SQDIFF": cv2.TM_SQDIFF,
    "TM_SQDIFF_NORMED": cv2.TM_SQDIFF_NORMED,
}

# 界面配置
UI = {
    "default_width": 1024,
    "default_height": 800,
    "style_file": "assets/style.qss",
}

# 路径配置
PATHS = {
    "sample_images": "assets/images",
    "assets": "assets",
}

# 图像识别配置
IMAGE_RECOGNITION = {
    "default_method": "TM_CCORR_NORMED",  # 改为使用字符串键来表示方法
    "default_threshold": 0.92,  # 提高默认阈值
    "scales": [0.8, 0.9, 1.0, 1.1, 1.25, 1.4, 1.5],
    "color_match_threshold": 0.7,  # 颜色匹配阈值
    "debug": False,  # 调试模式
    "show_thresholds": False,  # 显示匹配阈值
    "rectangle_thickness": 2,  # 矩形线条粗细
    "rectangle_color": (0, 255, 0),  # 矩形颜色 (BGR)
    "text_color": (255, 255, 255),  # 文本颜色 (BGR)
    "text_bg_color": (0, 0, 255),  # 文本背景色 (BGR)
    "font_scale": 0.5,  # 文本缩放
    "font_thickness": 1,  # 文本粗细
    "padding": 10,  # 文本内边距
    "margin": 2,  # 文本外边距
}

# 特殊模板配置
SPECIAL_TEMPLATES = {
    "power.png": {
        "color_threshold": 0.5,  # 为power.png专门降低颜色匹配阈值
        "confidence_threshold": 0.88,  # 为power.png单独设置置信度阈值
        "scales": [0.7, 0.8, 0.9, 1.0, 1.1, 1.2]  # 为power.png设置特定的缩放比例
    },
    "gold.png": {
        "color_threshold": 0.6,  # 为gold.png提高颜色匹配阈值，使其更难匹配
        "confidence_threshold": 0.95,  # 为gold.png提高置信度阈值
        "scales": [0.8, 0.9, 1.0, 1.1]  # 金币大小相对固定，减少缩放范围
    },
    "wood.png": {
        "color_threshold": 0.6,  # 为wood.png提高颜色匹配阈值，使其更难匹配
        "confidence_threshold": 0.91,  # 为wood.png提高置信度阈值
        "scales": [0.8, 0.9, 1.0, 1.1, 1.2, 1.3]  # 木材可能有不同大小
    },
    "ice.png": {
        "color_threshold": 0.65,  # 冰的颜色通常是蓝色，提高对蓝色的检测能力
        "confidence_threshold": 0.89,  # 冰的置信度阈值
        "scales": [0.85, 0.95, 1.0, 1.05, 1.15, 1.25]  # 冰的尺寸范围
    },
    "mana.png": {
        "color_threshold": 0.55,  # 魔法通常是蓝紫色，降低阈值增加匹配灵活性
        "confidence_threshold": 0.90,  # 魔法的置信度阈值
        "scales": [0.85, 0.95, 1.0, 1.05, 1.15]  # 魔法的尺寸范围
    },
    "glove.png": {
        "color_threshold": 0.58,  # 手套颜色可能多样，使用中等阈值
        "confidence_threshold": 0.92,  # 手套的置信度阈值
        "scales": [0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 1.3]  # 手套可能有不同大小
    },
    "belt.png": {
        "color_threshold": 0.58,  # 腰带颜色可能多样，使用中等阈值
        "confidence_threshold": 0.92,  # 腰带的置信度阈值
        "scales": [0.9, 0.95, 1.0, 1.05, 1.1, 1.2]  # 腰带可能有不同大小
    }
} 